From 37ee852d252d77537c645a978608e65b9673ad88 Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Wed, 3 Feb 2010 09:46:38 +0000 Subject: [PATCH] VT-d: fix a bug in enable_ats_device In enable_ats_device, it should enable ATS if find matched atsr unit for a device, and don't enable it if no matched atsr unit. But current code does contrarily. This patch fixes it. Signed-off-by: Weidong Han --- xen/drivers/passthrough/vtd/x86/ats.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/xen/drivers/passthrough/vtd/x86/ats.c b/xen/drivers/passthrough/vtd/x86/ats.c index 4f0ab75fe1..3c32538516 100644 --- a/xen/drivers/passthrough/vtd/x86/ats.c +++ b/xen/drivers/passthrough/vtd/x86/ats.c @@ -118,8 +118,13 @@ int enable_ats_device(int seg, int bus, int devfn) u16 queue_depth; int pos; - if ( acpi_find_matched_atsr_unit(bus, devfn) ) + if ( !acpi_find_matched_atsr_unit(bus, devfn) ) + { + dprintk(XENLOG_WARNING VTDPREFIX, + "cannot find matched atsr for %x:%x.%x\n", + bus, PCI_SLOT(devfn), PCI_FUNC(devfn)); return 0; + } pos = pci_find_ext_capability(seg, bus, devfn, PCI_EXT_CAP_ID_ATS); if ( !pos ) -- 2.30.2